4 months ago
A Java-based Model Context Protocol (MCP) server that provides deep introspection, monitoring, debugging, and REPL capabilities for Java applications. Descartes enables AI assistants to interact with running Java processes through a comprehensive set of tools and resources.
Kind of does for the Java backend what Playwright does for the frontend. Easy to add as a maven dependency to your Java application.
Overview
Descartes MCP
A Java-based Model Context Protocol (MCP) server that provides deep introspection, monitoring, debugging, and REPL capabilities for Java applications. Descartes enables AI assistants to interact with running Java processes through a comprehensive set of tools and resources.
⚠️ SECURITY WARNING: This tool includes a Java REPL that allows arbitrary code execution. It should ONLY be used in development/debugging environments and NEVER exposed to untrusted networks or users.
Features
🛠️ Tools
- JShell REPL: Interactive Java code execution with session management
- Object Inspector: Deep object introspection without code execution
- Process Inspector: Process and thread information monitoring
- System Monitoring: Real-time system metrics and resource usage
- Thread Analyzer: Thread state analysis and deadlock detection
- Memory Analyzer: Heap usage, garbage collection, and memory pool analysis
- Exception Analysis: Stack trace analysis and root cause identification
- Logging Integration: Log4j2 integration for log capture and analysis
📊 Resources
- Classpath Resource: Access to classpath information
- System Properties: JVM and system property access
- Metrics Resource: Application and JVM metrics
- Thread Dumps: Detailed thread state snapshots
- MBean Resource: JMX MBean access and monitoring
- Application Context: Access to registered application objects
Session Management
The JShell integration provides sophisticated session management:
- Isolated Execution Contexts: Each AI conversation gets its own JShell instance with separate variable namespaces, preventing cross-contamination between sessions.
- Configurable Timeouts: Sessions automatically expire after inactivity (default: 30 minutes) to prevent memory leaks.
- State Preservation: Variables and imports persist across multiple evaluations within the same session, enabling complex multi-step interactions.
- Context Injection: Application objects from the context map can be automatically exposed to JShell sessions, allowing direct manipulation of live application state.
- Concurrent Session Support: Multiple sessions can run simultaneously without interference.
Server Config
{
"mcpServers": {
"morpheus": {
"command": "node",
"args": [
"/path/to/mcp/mcp-tcp-adapter.js"
],
"env": {
"MCP_HOST": "localhost",
"MCP_PORT": "9080",
"MCP_DEBUG": "false",
"MCP_RECONNECT_MIN_DELAY": "500",
"MCP_RECONNECT_MAX_DELAY": "5000",
"MCP_HEALTH_CHECK_INTERVAL": "5000",
"MCP_LOG_RATE_LIMIT_WINDOW": "60000",
"MCP_LOG_RATE_LIMIT_MAX": "10"
}
}
}
}